package com.atguigu.serviceedu.client;

import com.atguigu.commonutils.R;
import com.atguigu.serviceedu.entity.History;
import com.atguigu.serviceedu.entity.Like;
import com.atguigu.serviceedu.entity.Order;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

/**
 * @Author: GengKY
 * @Date: 2021/9/25 18:42
 */

@FeignClient(name = "service-order")
@Component
public interface OrdersClient {

    @ApiOperation("查询课程订单并绘制表格")
    @GetMapping("/eduorder/order/getCourseOrderChars/{begin}/{end}")
    List<Order> getCourseOrderChars(@PathVariable(required = false) String begin,
                                           @PathVariable(required = false) String end);

    //http://localhost:8007/eduorder/order/isBuyCourse/10/1440938543827410946
    /**
     * 根据课程ID 和 用户ID 查询订单表中该课程是否购买
     */
    @GetMapping("/eduorder/order/isBuyCourse/{courseId}/{memberId}")
    boolean isByCourse(@PathVariable("courseId") String courseId,@PathVariable("memberId") String memberId);


    /**
     * 获取所有的订单信息
     * @return
     */
    @GetMapping("/eduorder/order/getAllOrder")
    R getAllOrderInfo();

    /**
     * 根据订单ID获取订单信息
     * @param orderNo
     * @return
     */
    @GetMapping("/eduorder/order/getOrderInfo/{orderNo}")
    R getOrderInfo(@PathVariable("orderNo") String orderNo);



    @GetMapping("/eduorder/like/getLikeListByNumberId/{memberid}")
    public List<Like> getLikeListByNumberId(@PathVariable String memberid);

    @GetMapping("/eduorder/history/getHistoryListByNumberId/{memberid}")
    public List<History> getHistoryListByNumberId(@PathVariable String memberid);

    @GetMapping("/eduorder/order/getOrderListByNumberId/{memberid}")
    public List<Order> getOrderListByNumberId(@PathVariable String memberid);

}
